<template>
	<view class="container">
		<Search @tap='jump' />
		<view class="swiper">
			<u-swiper :list="swiperList" previousMargin="30" nextMargin="30" circular :autoplay="true" radius="5"
				bgColor="#ffffff" height="160"></u-swiper>
		</view>
		<Channel :channelList='channelList' />
		<Discount :couponList='couponList' />
		<Groupbuy :grouponList='grouponList' />
		<Brand :brandList='brandList' />
		<NewGood :newGoodsList='newGoodsList' />
		<HotGood :hotGoodsList='hotGoodsList' />
		<Topic :topicList="topicList" />
		<FloorGood :floorGoodsList='floorGoodsList' />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				swiperList: [
					'https://yanxuan.nosdn.127.net/15484138535781739.jpg?imageView&thumbnail=1920y580&quality=95',
					'https://yanxuan.nosdn.127.net/15475330879632090.jpg?imageView&thumbnail=1920y580&quality=95',
					'https://yanxuan.nosdn.127.net/15487292264335065.jpg?imageView&thumbnail=1920y580&quality=95'
				],
				channelList: [],
				channelListImg: [],
				couponList: [],
				grouponList: [],
				brandList: [],
				newGoodsList: [],
				hotGoodsList: [],
				topicList: [],
				floorGoodsList: []
			};
		},
		onLoad() {
			this.$get(this.API.index).then((res) => {
				this.channelList = res.data.data.channel;
				this.couponList = res.data.data.couponList;
				this.grouponList = res.data.data.grouponList,
					this.brandList = res.data.data.brandList,
					this.newGoodsList = res.data.data.newGoodsList,
					this.hotGoodsList = res.data.data.hotGoodsList,
					this.topicList = res.data.data.topicList,
					this.floorGoodsList = res.data.data.floorGoodsList
			})
		},
		methods: {
			jump() {
				uni.navigateTo({
					url: "../../pages/search/search",
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	};
</script>

<style lang="scss">
	$marginBottom: 30rpx;
	$backColor: #f4f4f4;
	@import 'uview-ui/index.scss';

	.container {
		background-color: $backColor;

		.swiper {
			padding-bottom: $marginBottom;
			background-color: $uni-bg-color;
		}
	}
</style>
